function [trainImg trainLab testImg testLab] = getMNISTDigits(M,N)

cd ../problem1/

%Extract first M images and labels from the training set
trainImg = extractDigits('MNIST/train-images-idx3-ubyte',M);
trainLab = extractLabels('MNIST/train-labels-idx1-ubyte',M);

%Extract first N images and labels from the testing set
testImg = extractDigits('MNIST/t10k-images-idx3-ubyte',N);
testLab = extractLabels('MNIST/t10k-labels-idx1-ubyte',N);

end

